﻿<ng-include src="'./includes/header.html'"></ng-include>

<div class="main">
    <div class="container">
      <div class="row">
      		<div class="widget stacked">	
				<div class="widget-header">
					<i class="icon-bookmark"></i>
					<h3>{{ 'SHORTCUTS' | i18n }}</h3>
				</div> <!-- /widget-header -->
				<div class="widget-content">
					<div class="shortcuts">
                        <a ng-click="vm.refresh()" class="shortcut">
                            <i class="shortcut-icon icon-refresh"></i>
                            <span class="shortcut-label">{{ 'REFRESH' | i18n }}</span>
                        </a>
					</div> <!-- /shortcuts -->	
				</div> <!-- /widget-content -->
			</div> <!-- /widget -->
		</div>
        <div class="row" ng-show="server != null && server.server_id != null && server.server_id > 0">
            <div class="widget stacked">
                <div class="widget-header">
                    <i class="icon-bookmark"></i>
                    <h3>{{ 'SERVER' | i18n }}</h3>
                </div> <!-- /widget-header -->
                <div class="widget-content">
                    <table class="table table-striped table-bordered">
                        <thead>
                            <tr>
                                <th>#</th>
                                <th>{{ 'NAME' | i18n }}</th>
                                <th>{{ 'STATUS' | i18n }}</th>
                                <th>{{ 'LASTDATETIME' | i18n }}</th>
                                <th class="td-actions">{{ 'ACTIONS' | i18n }}</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td>{{server.server_id}}</td>
                                <td>{{server.name}}</td>
                                <td>
                                    <span ng-show="server.is_started" class="label label-success"><span class="icon icon-refresh">  {{ 'RUNNING' | i18n }}</span></span>
                                    <span ng-show="server.is_stopped" class="label label-info"><span class="icon icon-stop">  {{ 'STOPPED' | i18n }}</span></span>
                                    <span ng-show="server.is_updating" class="label label-important"><span class="icon icon-wrench">  {{ 'UPDATING' | i18n }}</span></span>
                                    <span ng-show="server.is_stopping" class="label label-warning"><span class="icon icon-arrow-down">  {{ 'STOPPING' | i18n }}</span></span>
                                    <span ng-show="server.is_starting" class="label label-warning"><span class="icon icon-arrow-up">  {{ 'STARTING' | i18n }}</span></span>
                                </td>
                                <td>{{server.last_datetime}}</td>
                                <td><a href="#/server/{{server.server_id}}" class="btn btn-info btn-lg btn-block" role="button"><span>{{ 'MANAGE' | i18n }}</span></a></td>
                            </tr>
                        </tbody>
                    </table>
                </div> <!-- /widget-content -->
            </div> <!-- /widget -->
        </div>
		<div class="row">
      		<div class="widget stacked widget-table action-table">
				<div class="widget-header">
					<i class="icon-th-list"></i>
					<h3>{{ 'MEMBERS' | i18n }}</h3>
				</div> <!-- /widget-header -->
				<div class="widget-content">
                    <form>
                        <div>
                            <label class="col-sm-3 control-label">{{ 'FILTERMEMBERS' | i18n }}</label>
                            <div class="form-group">
                                <input type="text" id="filter_member_name" class="input-medium" placeholder="{{ 'NAME' | i18n }}" ng-model="filter">
                            </div>
                        </div>
                    </form>
                    <form name="membersListForm">
                        <table class="table table-striped table-bordered">
                            <thead>
                                <tr>
                                    <th>#</th>
                                    <th>{{ 'NAME' | i18n }}</th>
                                    <th>{{ 'GAMEID' | i18n }}</th>
                                    <th>{{ 'RANK' | i18n }}</th>
                                    <th>{{ 'RIGHTS' | i18n }}</th>
                                    <th></th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr ng-repeat="member in members" ng-show="filter == null || filter.length <= 0 || member.member_name.toLowerCase().indexOf(filter.toLowerCase()) >= 0">
                                    <td>{{ member.member_id }}</td>
                                    <td>{{ member.member_name }}</td>
                                    <td>{{ member.game_id }}</td>
                                    <td>
                                        {{ member.member_rank }}
                                    </td>
                                    <td>
                                        <div ng-repeat="rights in member.rights | filter:{server_id: server.server_id}">
                                            <input ng-model="rights.rights_list" class="input-xxlarge" ng-show="user.role >= 4" />
                                            <span ng-bind="rights.rights_list" class="input-xxlarge uneditable-input" ng-show="user.role < 4"></span>
                                        </div>
                                    </td>
                                    <td>
                                        <a class="btn btn-success" ng-show="user.role >= 4 && !membersListForm.$pristine" ng-click="vm.saveRights()">
                                            <span class="icon-ok"></span>
                                        </a>
                                        <a class="btn btn-danger" ng-show="user.role >= 8 && !action.is_executed" ng-click="vm.deleteMember(member)">
                                            <span class="icon-remove"></span>
                                        </a>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </form>
				</div> <!-- /widget-content -->
			</div>
		</div>
	</div>
</div>
